package com.crm.service;

import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.crm.dao.DealDao;
import com.crm.dao.UserDao;
import com.crm.pojo.Deal;
import com.crm.pojo.User;

@Service
@Transactional
public class DealService {
	private DealDao dealDao;
	@Autowired
	private UserDao userDao;

	
	@Autowired
	public void setDealDao(DealDao dealDao) {
		this.dealDao = dealDao;
	}


	public List<Deal> findAll() {
		return dealDao.findAll();
	}


	public Set<Deal> findDealListByUserId(User u){
		
		User user = userDao.get(u.getId());
		
		return user.getDealSet();
	}

	
	
	

}
